package(
    default_visibility = ["//visibility:public"],
)

licenses(["notice"])  # Apache 2.0

load(
    "//mace:mace.bzl",
    "if_apu_enabled",
    "if_bfloat16_enabled",
    "if_fp16_enabled",
    "if_hexagon_enabled",
    "if_hexagon_or_hta_enabled",
    "if_hta_enabled",
    "if_opencl_enabled",
    "if_qnn_enabled",
)

cc_library(
    name = "flows",
    srcs = glob([
        "*.cc",
    ]),
    hdrs = glob([
        "*.h",
    ]),
    copts = [
        "-Werror",
        "-Wextra",
        "-Wno-missing-field-initializers",
    ] + if_opencl_enabled([
        "-DMACE_ENABLE_OPENCL",
    ]) + if_hexagon_enabled([
        "-DMACE_ENABLE_HEXAGON",
    ]) + if_hta_enabled([
        "-DMACE_ENABLE_HTA",
    ]) + if_apu_enabled([
        "-DMACE_ENABLE_MTK_APU",
    ]) + if_qnn_enabled([
        "-DMACE_ENABLE_QNN",
    ]) + if_bfloat16_enabled([
        "-DMACE_ENABLE_BFLOAT16",
    ]) + if_fp16_enabled([
        "-DMACE_ENABLE_FP16",
        "-march=armv8.2-a+fp16",
    ]),
    linkopts = ["-ldl"],
    deps = [
        "//mace/flows/cpu:cpu_flows",
    ] + if_opencl_enabled([
        "//mace/flows/opencl:opencl_flows",
    ]) + if_hexagon_or_hta_enabled([
        "//mace/flows/hexagon:hexagon_flows",
    ]) + if_apu_enabled([
        "//mace/flows/apu:apu_flows",
    ]) + if_qnn_enabled([
        "//mace/flows/qnn:qnn_flows",
    ]),
)
